package com.xugongzhang;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.concurrent.TimeUnit;

/**
 * @author X
 * @date 2022/6/27 21:04
 */
@SpringBootApplication
public class Juc {

    static boolean flag = true;

    public static void main(String[] args) {

        new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + "come in");
            while (flag) {

            }
            System.out.println("程序退出");
        }, "t1").start();

        try {
            TimeUnit.SECONDS.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        flag = false;
        System.out.println("改变flag的值：" + flag);
    }
}
